#include "app_buffer.h"
#include "log/log.h"
#include <string.h>

int main(int argc, char **argv)
{
    log_set_level(LOG_DEBUG);

    Buffer *buffer = app_buffer_init(8);
    
    app_buffer_write(buffer, "abcde", 5);
    app_buffer_write(buffer, "fg", 2);
    char read_buf[5];
    app_buffer_read(buffer, read_buf, 5);
    log_debug("Read from buffer: %s", read_buf);
    app_buffer_write(buffer, "hijk", 4);
    char read_buf2[2];
    app_buffer_read(buffer, read_buf2, 2);
    log_debug("Read from buffer: %s", read_buf2);
    char read_buf3[4];
    app_buffer_read(buffer, read_buf3, 4);
    // log_debug("Read from buffer: %s", read_buf3);
    log_debug("Read from buffer: %.*s", 4, read_buf3);

    app_buffer_free(buffer);
}